package com.yequan.thread.countdownlatch;

import java.util.concurrent.CountDownLatch;

/**
 * @author yq
 * @date 2020/09/03
 */
public class CountDownLatchDemo2 {

    public static CountDownLatch countDownLatch = new CountDownLatch(2);

    public static void main(String[] args) throws InterruptedException {
        new Thread(() -> {
            System.out.println(1);
            countDownLatch.countDown();
            System.out.println(2);
            countDownLatch.countDown();
        }).start();
        countDownLatch.await();
        System.out.println(3);
    }

}
